<?php
	defined( '_JEXEC' ) or die( 'Restricted access' );
	class HTML_socialroutes
	{
		function showConfig( $option, &$userRows, &$routeRows, &$poiRows )
		{
			?>
			<h2>Fusion Tables User</h2>
			<form action="index.php" method="post" name="adminRouteForm">
				<table class="adminlist">
					<thead>
						<tr>
							<th width="20">
								<input type="checkbox" name="toggle"
								value="" onclick="checkAll(<?php echo
								count( $userRows ); ?>);" />
							</th>
							<th class="title">Email</th>
							<th width="30%">Password</th>
							<th width="5%" nowrap="nowrap">Active</th>
						</tr>
					</thead>
					<?php
					jimport('joomla.filter.output');
					$k = 0;
					for ($i=0, $n=count( $userRows ); $i < $n; $i++){
						$row = &$userRows[$i];
						$checked = JHTML::_('grid.id', $i, $row->id );
						$link = 'index.php?option=' .$option . '&task=editUser&cid[]='. $row->id;
						?>
						<tr class="<?php echo "row$k"; ?>">
							<td>
								<?php echo $checked; ?>
							</td>
							<td align="center">
								<a href="<?php echo $link; ?>">
								<?php echo $row->email; ?></a>
							</td>
							<td align="center">
								<?php echo $row->passwd; ?>
							</td>
							<td align="center">
								<?php echo $row->active;?>
							</td>
						</tr>
						<?php
						$k = 1 - $k;
					}
				?>
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
			</form>
			<h2>Routes Fusion Tables</h2>
			<form action="index.php" method="post" name="adminRouteForm">
				<table class="adminlist">
					<thead>
						<tr>
							<th width="20">
								<input type="checkbox" name="toggle"
								value="" onclick="checkAll(<?php echo
								count( $routeRows ); ?>);" />
							</th>
							<th width="95%">FusionTableID</th>
							<th width="5%" nowrap="nowrap">Active</th>
						</tr>
					</thead>
					<?php
					jimport('joomla.filter.output');
					$k = 0;
					for ($i=0, $n=count( $routeRows ); $i < $n; $i++){
						$row = &$routeRows[$i];
						$checked = JHTML::_('grid.id', $i, $row->id );
						$link = 'index.php?option=' .$option . '&task=editRoute&cid[]='. $row->id;
						?>
						<tr class="<?php echo "row$k"; ?>">
							<td>
								<?php echo $checked; ?>
							</td>
							<td align="center">
								<a href="<?php echo $link; ?>">
								<?php echo $row->fusionTableID; ?></a>
							</td>
							<td align="center">
								<?php echo $row->active;?>
							</td>
						</tr>
						<?php
						$k = 1 - $k;
					}
				?>
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
			</form>
			<h2>POIs Fusion Tables</h2>
			<form action="index.php" method="post" name="adminPOIForm">
				<table class="adminlist">
					<thead>
						<tr>
							<th width="20">
								<input type="checkbox" name="toggle"
								value="" onclick="checkAll(<?php echo
								count( $poiRows ); ?>);" />
							</th>
							<th width="95%">FusionTableID</th>
							<th width="5%" nowrap="nowrap">Active</th>
						</tr>
					</thead>
					<?php
					jimport('joomla.filter.output');
					$k = 0;
					for ($i=0, $n=count( $poiRows ); $i < $n; $i++){
						$row = &$poiRows[$i];
						$checked = JHTML::_('grid.id', $i, $row->id );
						$link = 'index.php?option=' .$option . '&task=editPOI&cid[]='. $row->id;
						?>
						<tr class="<?php echo "row$k"; ?>">
							<td>
								<?php echo $checked; ?>
							</td>
							<td align="center">
								<a href="<?php echo $link; ?>">
								<?php echo $row->fusionTableID; ?></a>
							</td>
							<td align="center">
								<?php echo $row->active;?>
							</td>
						</tr>
						<?php
						$k = 1 - $k;
					}
				?>
				</table>
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="boxchecked" value="0" />
			</form>
			<?php
		}
		
		function editUserConfig($row, $lists, $option){
			$editor =& JFactory::getEditor();
			JHTML::_('behavior.calendar');
			?>
			<form action="index.php" method="post" name="adminForm" id="adminForm">
				<fieldset class="adminform">
					<legend>Details</legend>
					<table class="admintable">
						<tr>
							<td width="100" align="right" class="key">
								Email:
							</td>
							<td>
								<input class="text_area" type="text" name="email" id="email" size="50" maxlength="250" value="<?php echo $row->email;?>" />
							</td>
						</tr>
						<tr>
							<td width="100" align="right" class="key">
								Password:
							</td>
							<td>
								<input class="text_area" type="text" name="passwd" id="passwd" size="50" maxlength="250" value="<?php echo $row->passwd;?>" />
							</td>
						</tr>
						<tr>
							<td width="100" align="right" class="key">
								Active:
							</td>
							<td>
								<?php
								echo $lists['active'];
								?>
							</td>
						</tr>
					</table>
				</fieldset>
				<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="" />
			</form>
			<?php
		}
		function editFTConfig($row, $lists, $option){
			$editor =& JFactory::getEditor();
			JHTML::_('behavior.calendar');
			?>
			<form action="index.php" method="post" name="adminForm" id="adminForm">
				<fieldset class="adminform">
					<legend>Details</legend>
					<table class="admintable">
						<tr>
							<td width="100" align="right" class="key">
								Fusion Table ID:
							</td>
							<td>
								<input class="text_area" type="text" name="fusionTableID" id="fusionTableID" size="50" maxlength="250" value="<?php echo $row->fusionTableID;?>" />
							</td>
						</tr>
						<tr>
							<td width="100" align="right" class="key">
								Active:
							</td>
							<td>
								<?php
								echo $lists['active'];
								?>
							</td>
						</tr>
					</table>
				</fieldset>
				<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
				<input type="hidden" name="option" value="<?php echo $option;?>" />
				<input type="hidden" name="task" value="" />
			</form>
			<?php
		}
	}
?>